import React from 'react';
import { Link } from 'react-router-dom';
import moment from 'moment';

const getColumns = () => {
  const columns = [
    {
      title: 'Experience name',
      dataIndex: 'name',
      key: 'name',
      render: (_text: string, row: any) => (
        <Link to={`/policy/detail?id=${row.id as string}`}>
          <div>{row.name}</div>
        </Link>
      ),
    },
    {
      title: 'Country/Region',
      dataIndex: 'countryName',
      key: 'countryName',
    },
    {
      title: 'Author',
      dataIndex: 'author',
      key: 'author',
    },
    {
      title: 'Publish time',
      key: 'createTime',
      dataIndex: 'createTime',
      render: (text: any) => (text ? moment(text).format('YYYY/MM/DD') : ''),
    },
  ];

  return columns;
};

export { getColumns };
